#include <Starter.hpp>
#include <Misc/Config.hpp>
#include <Misc/Log.hpp>


/* Function prototype */
void printHelp();


int main(int argc, char** argv) {

	/* Parse parameters*/
	Config *config = Config::instance();
	config->parseArguments(argc,argv);

	/* Start logger */
	Log::instance().open(config->getLogFile());

	if(config->isHelpFlag()){
		printHelp();
		return 0;
	}else{
		Starter starter;
		return starter.start();
	}

}

void printHelp(){

	std::cout << "ibrc-client" << std::endl;
	std::cout << "Usage: ibrc_client [args]" << std::endl;
	std::cout << "Options:" << std::endl;
	std::cout << " -h --help\t Prints this help message." << std::endl;
	std::cout << " -p PORT\t Specifies the used port." << std::endl;
	std::cout << " -a ADDRESS\t Specifies the server IP-Address." << std::endl;
	std::cout << " -IPv6\t\t Activates IPv6 support (IPv4 is default)." << std::endl;
	std::cout << " -in\t\t INPUT file location." << std::endl << std::endl;
	std::cout << " -out\t\t OUTPUT file location." << std::endl << std::endl;
	std::cout << " -l\t\t LOGFILE Log file location." << std::endl << std::endl;


}
